package cn.catsdad.repository;

import cn.catsdad.base.repository.api.IBaseRepository;
import cn.catsdad.dto.DepartmentUserDTO;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.List;

/**
 * 部门用户repository
 *
 * @author xuyonglong
 * @version V1.0 2023/4/12
 */
public interface DepartmentUserRepository extends IBaseRepository<DepartmentUserDTO, Long> {

    /**
     * 根据用户id查询
     *
     * @param userIds userid
     * @return 关联数据
     */
    List<DepartmentUserDTO> findByUserIdIn(Collection<Long> userIds);

    /**
     * 根据用户id删除数据
     *
     * @param userIds 用户id
     */
    @Transactional
    @Modifying
    void deleteByUserIdIn(Collection<Long> userIds);

}
